package dst1.model;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Table(name="JOB")
public class Job implements Serializable{

	@Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name="ID") 
	private Long id;
	
	@Column(name="NUMCPUS") 
	private Integer numCPUs;
	
	@Column(name="EXECUTIONTIME") 
	private Integer executionTime;
	
	@Column(name="ISPAID") 
	private Boolean isPaid;
	
	@OneToOne(cascade=CascadeType.ALL, fetch=FetchType.LAZY)
	private Environment environment;
	
	@OneToOne(cascade=CascadeType.ALL, fetch=FetchType.LAZY)
	private Execution execution;
	
	@ManyToOne(fetch=FetchType.LAZY)
	private User user;
	
	public Job(){
		
	}

	public Job(Integer numCPUs, Integer executionTime, Boolean isPaid,
			Environment environment, Execution execution, User user) {
		super();
		this.numCPUs = numCPUs;
		this.executionTime = executionTime;
		this.isPaid = isPaid;
		this.environment = environment;
		this.execution = execution;
		this.user = user;
	}

	public Long getId() {
		return id;
	}

	public Integer getNumCPUs() {
		return numCPUs;
	}

	public void setNumCPUs(Integer numCPUs) {
		this.numCPUs = numCPUs;
	}

	public Integer getExecutionTime() {
		return executionTime;
	}

	public void setExecutionTime(Integer executionTime) {
		this.executionTime = executionTime;
	}

	public Boolean getIsPaid() {
		return isPaid;
	}

	public void setIsPaid(Boolean isPaid) {
		this.isPaid = isPaid;
	}

	public Environment getEnvironment() {
		return environment;
	}

	public void setEnvironment(Environment environment) {
		this.environment = environment;
	}

	public Execution getExecution() {
		return execution;
	}

	public void setExecution(Execution execution) {
		this.execution = execution;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	
		
}
